package com.cqc.manage.repositories;

import com.cqc.manage.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;

public interface UserRepositories extends JpaRepository<User,String> , JpaSpecificationExecutor<User>, CrudRepository<User,String> {

    /**
     * 通过用户名和密码查找用户
     * @param userName
     * @param userPassword
     * @return
     */
    User findUserByUserNameAndAndUserPassword(String userName,String userPassword);

    Page<User> findAll(Pageable pageable);

    /**
     * 通过用户名查询用户
     * @param userName
     * @return
     */
    User findUserByUserName(String userName);

    /**
     * 通过账号查询用户
     * @param userAccount
     * @return
     */
    User findUserByUserAccount(String userAccount);

    /**
     * 查询用户名
     * @param userAccount
     * @param password
     * @return
     */
    User findUserByUserAccountAndUserPassword(String userAccount,String password);

}
